/*
 *------------------------------------------------------------------------------
 * @File      :    ei_mai_smart_define.h
 * @Date      :    2021-4-8
 * @Author    :    lomboswer <lomboswer@lombotech.com>
 * @Brief     :    Media Interface for MADP(Media Development Platform).
 *
 * Copyright (C) 2020-2021, LomboTech Co.Ltd. All rights reserved.
 *------------------------------------------------------------------------------
 */

#ifndef __EI_SMART_DEFINE_H__
#define __EI_SMART_DEFINE_H__

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#include <pthread.h>

#include "mi_vdec.h"

#include "ei_comm_aio.h"

#include "ei_nna_fd.h"
#include "ei_nna_ft.h"
#include "ei_nna_fa.h"
#include "ei_nna_fc.h"
#include "ei_nna_fp.h"
#include "ei_nna_fr.h"
#include "ei_nna_hd.h"
#include "ei_nna_ht.h"
#include "ei_nna_md.h"
#include "ei_nna_fmd.h"
#include "ei_nna_fmc.h"
#include "ei_nna_fmr.h"
#include "ei_nna_fod.h"
#include "ei_nna_lpd.h"
#include "ei_nna_pnv.h"
#include "ei_nna_lpr.h"
#include "ei_nna_sed.h"
#include "ei_nna_pets.h"
#include "ei_nna_qr.h"
#include "ei_nna_hfd.h"
#include "ei_nna_handdet.h"
#include "ei_nna_gesture.h"
#include "ei_nna_handtrk.h"
#include "ei_nna_wavehand.h"

typedef enum eiMADP_SMART_ERR_CODE_E {
	EN_ERR_FACE_RECG_INITIALIZED        = 0x01,
	EN_ERR_FACE_RECG_UNINITIALIZED      = 0x02,
	EN_ERR_FACE_DET_INITIALIZED         = 0x03,
	EN_ERR_FACE_DET_UNINITIALIZED       = 0x04,
	EN_ERR_FACE_VDEC_JPEG_FAILED        = 0x05,
	EN_ERR_FACE_DET_MULTI_FACE          = 0x06,
	EN_ERR_FACE_NO_DET_FACE             = 0x07,
	EN_ERR_FACE_GET_FEATURE_FAILED      = 0x08,
	EN_ERR_FACE_CLARITY_TOO_LOW         = 0x09,
} EI_MADP_SMART_ERR_CODE_E;

typedef struct eiMADP_SMART_FRAME_S {
	EI_U64 u64Timestamp;
	EI_U64 u64VencTimestamp;
	EI_U32 u32Id; /* smart frame id */

	union {
		EI_NNA_FRAME_DATA_S stNNAFrame;
		EI_NNA_FRAME_DATA_S stFrameData; // bad name
	};

	EI_U32 MdpDev;
	EI_U32 MdpCh;

	EI_VOID *MdpPriv; /* VIDEO_FRAME_INFO_S */

	VIDEO_FRAME_INFO_S stVideoFrame;
	EI_BOOL bScaled; //1: VIDEO_FRAME_INFO_S scaled

	//record frame nna det info
	EI_VOID *pstNnaInfo;
	//record frame venc info
	EI_VOID *pstVencInfo;
} EI_MADP_SMART_FRAME_S;

typedef struct eiMADP_SMART_AFRAME_S {
	EI_U64 u64Timestamp;
	EI_U32 u32Id; /* smart aframe id */

	AUDIO_FRAME_S stFrame;
	AEC_FRAME_S stAecFrm;

	EI_U32 MdpDev;
	EI_U32 MdpCh;
	EI_VOID *MdpPriv;
} EI_MADP_SMART_AFRAME_S;


typedef struct eiMADP_SMART_OSD_ADD_S {
	EI_BOOL bOsdEnable;
	EI_BOOL bOsdTimeEnable;
	EI_BOOL bOsdTextEnable;
	EI_S32 s32X;
	EI_S32 s32Y;
	EI_U32 u32W;
	EI_U32 u32H;
	EI_U32 u32BgColor;
	EI_U32 enPixelFmt;
	EI_VOID *pData;
	EI_U32 u32Stride;
	EI_U32 u32FgAlpha;
	pthread_mutex_t OsdDatalock;
} EI_MADP_SMART_OSD_ADD_S;

typedef struct eiMADP_SMART_DET_STATUS_S {
	EI_U32 DetFaceCnt;
	EI_U32 DetHumanCnt;
	EI_U32 DetMBGSCnt;
	EI_U32 DetLpdCnt;
	EI_U32 DetPnvCnt;
	EI_U32 DetCarCnt;
	EI_U32 DetHandCnt;
} EI_MADP_SMART_DET_STATUS_S;

typedef struct eiMADP_SMART_DET_FRAME_RATE_S {
	EI_U32 DetFrameRate;
	EI_U32 DetFaceRate;
	EI_U32 DetHumanRate;
	EI_U32 DetMBGSRate;
	EI_U32 DetISPMDRate;
	EI_U32 DetCarRate;
	EI_U32 DetQRRate;
	EI_U32 DetHandRate;
} EI_MADP_SMART_DET_FRAME_RATE_S;

typedef struct eiMADP_SMART_VENC_ATTR_S {
	EI_HANDLE hVencHdl;
	EI_U32 u32BufSize;
	EI_U32 u32PicWidth;
	EI_U32 u32PicHeight;
} EI_MADP_SMART_VENC_ATTR_S;

typedef struct eiMADP_SMART_VDEC_ATTR_S {
	EI_HANDLE hVdecHdl;

	EI_U32 u32PicWidth;
	EI_U32 u32PicHeight;
	VDEC_SCALE_S stScaleAttr;
} EI_MADP_SMART_VDEC_ATTR_S;

typedef struct eiMADP_SMART_FRAME_ATTR_S {
	EI_S32 s32ScaledEn; // 0 :disable 1: enable
	EI_U32 u32ScaledWidth;
	EI_U32 u32ScaledHeight;

	EI_U32 u32MaxFrameCnt; //smart get frame max conut
} EI_MADP_SMART_FRAME_ATTR_S;

typedef struct eiMADP_SMART_ATTR_S {
	EI_S32 s32VencEn; // 0 :disable 1: enable
	EI_MADP_SMART_VENC_ATTR_S stSmartVencAttr;

	EI_S32 s32VdecEn;
	EI_MADP_SMART_VDEC_ATTR_S stSmartVdecAttr;

	EI_MADP_SMART_FRAME_ATTR_S stSmartFrameAttr;

	EI_CHAR *ModelRootPath;
} EI_MADP_SMART_ATTR_S;

/** the attribute of smart facedet */
typedef struct eiMADP_SMART_HUMFACEDET_ATTR_S {
	EI_U32 u32FrameWidth;
	EI_U32 u32FrameHeight;
} EI_MADP_SMART_HUMFACEDET_ATTR_S;

#include "ei_mai_smart_face.h"
#include "ei_mai_smart_human.h"
#include "ei_mai_smart_recg.h"
#include "ei_mai_smart_mbgs.h"
#include "ei_mai_smart_ispmd.h"
#include "ei_mai_smart_lpd.h"
#include "ei_mai_smart_pnv.h"
#include "ei_mai_smart_car.h"
#include "ei_mai_smart_sed.h"
#include "ei_mai_smart_noise.h"
#include "ei_mai_smart_qr.h"
#include "ei_mai_smart_pets.h"
#include "ei_mai_smart_hand.h"

/* old code format api start */
#define EI_MAI_Smart_Init EI_MAI_SMART_Init

#define EI_MAI_Smart_DeInit EI_MAI_SMART_DeInit

#define EI_MAI_Smart_AFrame_Input  EI_MAI_SMART_AFrame_Input

#define EI_MAI_Smart_Frame_Pause EI_MAI_SMART_Frame_Pause

#define EI_MAI_Smart_Frame_Resume EI_MAI_SMART_Frame_Resume

#define EI_MAI_Smart_GetLogLevel EI_MAI_SMART_GetLogLevel

#define EI_MAI_Smart_SetLogLevel EI_MAI_SMART_SetLogLevel

#define EI_MAI_Smart_Set_Debug_Level EI_MAI_SMART_SetLogLevel

#define EI_MAI_Smart_Venc_DrawBGBox EI_MAI_SMART_Venc_DrawBGBox

#define EI_MAI_Smart_Retain_Ptr EI_MAI_SMART_Retain_Ptr

#define EI_MAI_Smart_Release_Ptr EI_MAI_SMART_Release_Ptr

#define EI_MAI_Smart_FaceCapInit EI_MAI_SMART_FaceCapInit

#define EI_MAI_Smart_FaceCapDeInit EI_MAI_SMART_FaceCapDeInit

#define EI_MAI_Smart_FaceCapGetAttr EI_MAI_SMART_FaceCapGetAttr

#define EI_MAI_Smart_FaceCapSetAttr EI_MAI_SMART_FaceCapSetAttr

#define EI_MAI_Smart_FaceRecgCreate EI_MAI_SMART_FaceRecgCreate

#define EI_MAI_Smart_FaceRecgDestroy EI_MAI_SMART_FaceRecgDestroy

#define EI_MAI_Smart_FaceRecgGetAttr EI_MAI_SMART_FaceRecgGetAttr

#define EI_MAI_Smart_FaceRecgSetAttr EI_MAI_SMART_FaceRecgSetAttr

#define EI_MAI_Smart_FaceGetFeatures EI_MAI_SMART_FaceGetFeatures

#define EI_MAI_Smart_CTL_SetFaceCapRecgStep EI_MAI_SMART_CTL_SetFaceCapRecgStep

#define EI_MAI_Smart_Err_Msg EI_MAI_SMART_Err_Msg

#define EI_MAI_Smart_FaceCompare EI_MAI_SMART_FaceCompare

#define EI_MAI_Smart_FaceRecgCompare EI_MAI_SMART_FaceRecgCompare

#define EI_MAI_Smart_FaceRegisterFeatures EI_MAI_SMART_FaceRegisterFeatures

#define EI_MAI_Smart_HumanCapInit EI_MAI_SMART_HumanCapInit

#define EI_MAI_Smart_HumanCapDeInit EI_MAI_SMART_HumanCapDeInit

#define EI_MAI_Smart_HumanCapGetAttr EI_MAI_SMART_HumanCapGetAttr

#define EI_MAI_Smart_HumanCapSetAttr EI_MAI_SMART_HumanCapSetAttr

#define EI_MAI_Smart_CTL_DET_FrameRate EI_MAI_SMART_CTL_DET_FrameRate

#define EI_MAI_Smart_Region_Info EI_MAI_SMART_Region_Info


/* old code format api end*/


#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

#endif /* __EI_SMART_DEFINE_H__ */

